package ae.pcfc.etks.online.itworx.ehs.web.messaging;

import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Component;

import ae.pcfc.etks.online.itworx.ehs.web.entity.OFCRequest;
import ae.pcfc.etks.online.itworx.ehs.web.model.Rollback;

@Component
public class JmsMessageProducer {

	private JmsTemplate rollbackJMSTemplate = null;
	private JmsTemplate ofcRequestJMSTemplate=null;
	
	public void setRollbackJMSTemplate(JmsTemplate rollbackJMSTemplate) {
		this.rollbackJMSTemplate = rollbackJMSTemplate;
	}

	public void setOfcRequestJMSTemplate(JmsTemplate ofcRequestJMSTemplate) {
		this.ofcRequestJMSTemplate = ofcRequestJMSTemplate;
	}

	/**
	 * Generates JMS messages
	 */
	public void generateRollbackMessage(Rollback rollback) {

		rollbackJMSTemplate.convertAndSend(rollback);
	}
	
	public void generatePendingRequestMessage(OFCRequest ofcRequest)
	{
		ofcRequestJMSTemplate.convertAndSend(ofcRequest);
	}
}
